#!/bin/bash

#DNS panel for BigLinux
#
#Authors:
#  Bruno Goncalves Araujo <www.biglinux.com.br>
#
#License: GPLv2 or later
#################################################



. /usr/share/bigcontrolcenter/default/theme-categories.sh.htm

#Translation
export TEXTDOMAINDIR="/usr/share/locale-langpack"
export TEXTDOMAIN=bigcontrolcenter-system-autostart

if [ "$KDEHOME" = "" ]
then
  BIGKDEHOME=$HOME/.kde
else
  BIGKDEHOME=$KDEHOME
fi

echo '
<script language="JavaScript">
window.resizeTo(640,480);
function NoResize(){
  window.resizeTo(640,480);
}
</script>
'


title=$"Iniciar automaticamente"
apply=$"Aplicar"
close=$"Sair"
back=$"Voltar para tela de configuracao"

#title
echo "<title>$title</title><body onResize=\"NoResize();\">"

#header
open_header
echo "$title" '</font><br>' $"Escolha o que deve ser iniciado ao ligar o PC."
close_header


#confere as variaveis que sao traduzidar com um p_ antes do nome
if [ "$p_jockey_gtk" = "yes" ]
then
    echo "#!/bin/bash

sh -c 'test -e /var/cache/jockey/check || exec jockey-gtk --check 60'" > $BIGKDEHOME/Autostart/jockey-gtk
    chmod +x $BIGKDEHOME/Autostart/jockey-gtk
else
    rm -f $BIGKDEHOME/Autostart/jockey-gtk
fi

if [ "$p_update_notifier" = "yes" ]
then
    echo "#!/bin/bash

update-notifier --startup-delay=60" > $BIGKDEHOME/Autostart/update-notifier
    chmod +x $BIGKDEHOME/Autostart/update-notifier
else
    rm -f $BIGKDEHOME/Autostart/update-notifier
fi

if [ "$p_bluetooth_applet" = "yes" ]
then
    echo "#!/bin/bash

bluetooth-applet" > $BIGKDEHOME/Autostart/bluetooth-applet
    chmod +x $BIGKDEHOME/Autostart/bluetooth-applet
else
    rm -f $BIGKDEHOME/Autostart/bluetooth-applet
fi


#Exibir resposta para o usuario
echo "<br><br><br><br><br><center><font size=+2>"
echo $"Configuracao aplicada."
echo "</font></div><div id=\"rodape\"><button type=button  onClick=\"parent.location='autostart.sh.htm'\">   <img src=\"/usr/share/bigcontrolcenter/default/images/ok.png\" style=\"vertical-align:top\" />  $back   </button> 

<button type=button onClick= parent.location='/usr/share/bigbashview/exemplo2.sh.htm?close=True'>   <img src=\"/usr/share/bigcontrolcenter/default/images/cancel.png\" style=\"vertical-align:top\"  />  $close     </button></form></div></body>"
